<template>
<div class="layout">
        <Layout>
            <Header>
                <Menu mode="horizontal" theme="dark" active-name="1">
                    <div class="layout-logo">WHY</div>
                    <div class="layout-nav">
                        <MenuItem name="1">
                            <router-link to="/user" tag="li">
                                <Icon type="ios-navigate"></Icon>
                                用户模块
                            </router-link>
                        </MenuItem>
                        <MenuItem name="2">
                            <router-link to="/cate" tag="li">
                                <Icon type="ios-keypad"></Icon>
                                分类模块
                            </router-link>
                        </MenuItem>
                        <MenuItem name="3">
                            <router-link to="/news" tag="li">
                                <Icon type="ios-analytics"></Icon>
                                新闻模块
                            </router-link>
                        </MenuItem>
                        <MenuItem name="4">
                            <Icon type="ios-paper"></Icon>
                            产品模块
                        </MenuItem>
                    </div>
                </Menu>
            </Header>
            <Layout>
                <Sider hide-trigger :style="{background: '#fff'}">
                    <Menu active-name="1-2" theme="light" width="auto" :open-names="['1']">
                        <Submenu name="1">
                            <template slot="title">
                                <Icon type="ios-navigate"></Icon>
                                <router-link to="/user" tag="span" @click.native="show">
                                    用户模块
                                </router-link>
                            </template>
                            <!-- <MenuItem name="1-2">用户信息</MenuItem> -->
                        </Submenu>
                        <Submenu name="2">
                            <template slot="title">
                                <Icon type="ios-keypad"></Icon>
                                <router-link to="/cate" tag="span" @click.native="show">
                                    分类模块
                                </router-link>
                            </template>
                        </Submenu>
                        <Submenu name="3">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                <router-link to="/news" tag="span" @click.native="show">
                                    新闻模块
                                </router-link>
                            </template>
                        </Submenu>
                        <Submenu name="4">
                            <template slot="title">
                                <Icon type="ios-paper"></Icon>
                                产品模块
                            </template>
                        </Submenu>
                    </Menu>
                </Sider>
                <Layout :style="{padding: '0 24px 24px'}">
                    <Breadcrumb :style="{margin: '24px 0'}">
                        <BreadcrumbItem>{{NowTitle}}</BreadcrumbItem>
                    </Breadcrumb>
                    <Content :style="{padding: '24px', minHeight: '280px', background: '#fff'}">
                        <router-view></router-view>
                    </Content>
                </Layout>
            </Layout>
        </Layout>
    </div>
</template>

<script>
export default {
    data(){
        return{
          NowTitle: "首页"
        }
    },
    methods:{
        show(event){
            this.NowTitle = event.target.innerHTML
        }
    }
}
</script>

<style scoped>
.layout{
    border       : 1px solid #d7dde4;
    background   : #f5f7f9;
    position     : relative;
    border-radius: 4px;
    overflow     : hidden;
}
.layout-logo{
    width        : 100px;
    height       : 30px;
    background   : #5b6270;
    border-radius: 3px;
    float        : left;
    position     : relative;
    top          : 15px;
    left         : 20px;
    color        : #fff;
    line-height  : 30px;
    text-align   : center;
}
.layout-nav{
    width       : 490px;
    margin      : 0 auto;
    margin-right: 20px;
}
</style>
